package com.forever.thread.queues;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class QueuesTest {

	public static void main(String[] args) {
		BlockingQueue<String> queue = new ArrayBlockingQueue<String>(5);
		try {
			System.out.println(queue.size());
			System.out.println(queue.offer("1"));
			System.out.println(queue.add("1"));
			System.out.println(queue.add("1"));
			System.out.println(queue.add("1"));
			System.out.println(queue.add("1"));
			System.out.println(queue.add("1"));
			System.out.println(queue.add("1"));
			System.out.println(queue.add("1"));
			System.out.println(queue.size());
			System.out.println(queue.toString());
		} catch (Exception e) {
			try {
				queue.take();
			} catch (InterruptedException e1) {
				e1.printStackTrace();
			}
			e.printStackTrace();
		}
	}
}
